package export;

import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
import neuron.Dendrite;
import neuron.Statistics;

import common.statistics.Series;

public class StatisticsCollection {
	
	Series nTS = new Series();
	Series asym = new Series();
	Series totLen = new Series();
	Series intLen = new Series();
	Series tsLen = new Series();
	
	public void add(Dendrite d)
	{
		Statistics s = new Statistics(d.root);
		nTS.add(s.countTerminalSegments());
		asym.add(s.asymmetricIndex());
		totLen.add(s.totalLength());
		intLen.merge(s.intermediateSegmentLengths());
		tsLen.merge(s.terminalSegmentLengths());
	}
	
	public void write(ExcelWriter ew) throws RowsExceededException, WriteException {
		ew.write(nTS.count());
		ew.write(nTS);
		ew.write(asym);
		ew.write(totLen.sum());
		ew.write(totLen);
		ew.write(intLen);
		ew.write(tsLen);
	}
}
